package com.jt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jt.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
//继承时必须添加泛型,该泛型必须与表关联
//mp提供了强大的单表操作CURD操作,多表操作自己写
public interface UserMapper extends BaseMapper<User> {


    List<User> findAll();

    User       findUserByUP(User user);

    @Select("SELECT COUNT(1) FROM user")
    long findTotal();

    //Mybatis只支持单值传参 封装为map集合,用@Param注解
    List<User> findUserList(@Param("start")int start,@Param("size") int size, @Param("query")String query);


    @Update("update user set status=#{status},updated=#{updated} where id=#{id}")
    void updateStautas(User user);

    @Delete("Delete from user where id=#{id} ")
    void deleteBuyId(Integer id);


    void saveUser(User user);

    @Select("select * from user where id=#{id}")
    User findUserById(Integer id);

    void updateUser(User user);
}
